/**
 * @Author 12629
 * @Description：
 */
public class Test {

    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();

        binaryTree.preOrder(root);
        System.out.println("=====");
        binaryTree.preOrderNor(root);


        binaryTree.inOrder(root);
        System.out.println("=====");
        binaryTree.inOrderNor(root);


        binaryTree.postOrder(root);
        System.out.println("=====");

        binaryTree.postOrderNor(root);
        System.out.println("=======================================");


        /*binaryTree.nodeSize(root);

        System.out.println("节点个数："+binaryTree.countNode);*/

        int nodeSize = binaryTree.nodeSize2(root);
        System.out.println("节点个数："+nodeSize);


        /*int leafSize = binaryTree.getLeafNodeCount(root);
        System.out.println("叶子节点个数："+leafSize);*/

        binaryTree.getLeafNodeCount2(root);

        System.out.println("叶子节点个数："+binaryTree.leafNodeSize);


        int kLeveNodeSize = binaryTree.getKLeveNodeSize(root, 4);
        System.out.println("第K层的节点个数："+kLeveNodeSize);


        int height = binaryTree.getHeight(root);
        System.out.println("树的高度："+height);

        BinaryTree.TreeNode ret = binaryTree.find(root,'B');
        System.out.println("找到value值："+ ret.val);

        System.out.println("层序遍历结果如下: ");
        binaryTree.levelOrder(root);

        boolean completeTree = binaryTree.isCompleteTree(root);
        System.out.println("是否是完全二叉树："+completeTree);
    }
}
